/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package metier.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;

/**
 *
 * @author Adrien
 */
@Entity
public class Virement implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name="virement_id_seq",
                       sequenceName="virement_id_seq",
                       allocationSize=1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE,
                    generator="virement_id_seq")
    private Long id;
    
    @ManyToOne
    private Compte debiteur;
    
    @ManyToOne
    private Compte crediteur;
    
    @Column
    private Float montant;
    
    @Column
    private java.sql.Timestamp date_maj;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Compte getDebiteur() {
        return debiteur;
    }

    public void setDebiteur(Compte debiteur) {
        this.debiteur = debiteur;
    }

    public Compte getCrediteur() {
        return crediteur;
    }

    public void setCrediteur(Compte crediteur) {
        this.crediteur = crediteur;
    }

    public Float getMontant() {
        return montant;
    }

    public void setMontant(Float montant) {
        this.montant = montant;
    }

    public java.sql.Timestamp getDate_maj() {
        return date_maj;
    }

    public void setDate_maj(java.sql.Timestamp date_maj) {
        this.date_maj = date_maj;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Virement)) {
            return false;
        }
        Virement other = (Virement) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "metier.entity.Virement[ id=" + id + " ]";
    }
    
}
